home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Utilities / Remotes / Source / remsubs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-23  |  2.4 KB  |  63 lines

  1. /*---------------------------------------------------------------------------
  2. remsubs.c -- Copyright (c) 1990 Rex Pruess
  3.   
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 1, or (at your option)
  7.    any later version.
  8.   
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.   
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA or send
  17.    electronic mail to the the author.
  18.   
  19.   
  20. These miscellaneous support routines contain code that would otherwise have
  21. to be repeated often in the various methods used by the Remotes application.
  22.   
  23. Rex Pruess <rpruess@umaxc.weeg.uiowa.edu>
  24.   
  25. $Header: /rpruess/apps/Remotes3.0/RCS/remsubs.c,v 3.0 92/09/23 22:16:10 rpruess Exp $
  26. -----------------------------------------------------------------------------
  27. $Log:    remsubs.c,v $
  28.  * Revision 3.0  92/09/23  22:16:10  rpruess
  29.  * Checked in to RCS to get the revision number updated to 3.0.
  30.  * 
  31.  * Revision 2.0  91/01/22  15:33:09  rpruess
  32.  * Remotes-2.0 was upgraded for NeXT System Release 2.0 (standard or extended).
  33.  * Remotes-2.0 supports the NeXT supplied Terminal application and the Stuart
  34.  * shareware product.
  35.  * 
  36.  * Revision 1.1  90/04/10  14:31:50  rpruess
  37.  * Initial revision
  38.  * 
  39. -----------------------------------------------------------------------------*/
  40.  
  41. /* Standard C header files */
  42. #include <stdio.h>
  43. #include <strings.h>
  44.  
  45. /*---------------------------------------------------------------------------
  46. This routine extracts the next field from buffer & stores it in field.  The
  47. routine returns the pointer to the next field in buffer.  If there is not a
  48. next field, the null pointer is returned.  Valid field separators are tab &
  49. newline.
  50. -----------------------------------------------------------------------------*/
  51. char           *getfield (char *bufPtr, char *field)
  52. {
  53.    while (*bufPtr != '\t' && *bufPtr != '\n' && *bufPtr != '\0')
  54.       *field++ = *bufPtr++;
  55.  
  56.    if (*bufPtr == '\0')
  57.       return NULL;
  58.  
  59.    *field = '\0';               /* Terminate string correctly */
  60.  
  61.    return ++bufPtr;
  62. }
  63.